module.exports = function(window, document) {
	var apivm = require('../../common/avm.min')(window, document);
	var avm = apivm;
	var api = apivm.api;
	var Component = apivm.Component;
	var $ = apivm.$;
	(function() {
	var StatusBarView = /*@__PURE__*/ (function(Component) {
		function StatusBarView(props) {
			Component.call(this, props);
			this.compute = {
				statusBarHeight: function() {
					if (api.safeArea) {
						return api.safeArea.top;
					} else {
						var res = wx.getSystemInfoSync();
						return res.statusBarHeight;
					}
				}
			};
		}

		if (Component) StatusBarView.__proto__ = Component;
		StatusBarView.prototype = Object.create(Component && Component.prototype);
		StatusBarView.prototype.constructor = StatusBarView;
		StatusBarView.prototype.render = function() {
			return apivm.h("view", {style: "height:" + this.statusBarHeight + "px;"});
		};

		return StatusBarView;
	})(Component);
	apivm.define("status-bar-view", StatusBarView);

	var Navigationbar = /*@__PURE__*/ (function(Component) {
		function Navigationbar(props) {
			Component.call(this, props);
		}

		if (Component) Navigationbar.__proto__ = Component;
		Navigationbar.prototype = Object.create(Component && Component.prototype);
		Navigationbar.prototype.constructor = Navigationbar;
		Navigationbar.prototype.onLeftButton = function(e) {
			api.closeWin();
		};
		Navigationbar.prototype.render = function() {
			return apivm.h(
				"view",
				{class: "nav-container"},
				apivm.h("status-bar-view", null),
				apivm.h(
					"view",
					{class: "nav-header"},
					apivm.h(
						"view",
						{
							class: "nav-header-button nav-left-button",
							onclick: this.props.onLeftButton
								? this.props.onLeftButton
								: this.onLeftButton
						},
						apivm.h("image", {
							width: this.props.leftButtonWidth ? this.props.leftButtonWidth : 11,
							src: this.props.leftButtonIcon
								? this.props.leftButtonIcon
								: "../../image/back.png",
							mode: "widthFix"
						}),
						apivm.h("text", {class: "nav-header-text"}, this.props.leftButtonText)
					),
					apivm.h("text", {class: "nav-header-title"}, this.props.title),
					apivm.h(
						"view",
						{
							class: "nav-header-button nav-right-button",
							onclick: this.props.onRightButton
						},
						apivm.h("image", {
							width: this.props.rightButtonWidth ? this.props.rightButtonWidth : 0,
							src: this.props.rightButtonIcon ? this.props.rightButtonIcon : "",
							mode: "widthFix"
						}),
						apivm.h("text", {class: "nav-header-text"}, this.props.rightButtonText)
					)
				)
			);
		};

		return Navigationbar;
	})(Component);
	apivm.define("navigationBar", Navigationbar);

	var Customerservice = /*@__PURE__*/ (function(Component) {
		function Customerservice(props) {
			Component.call(this, props);
			this.data = {
				marginBottom: 0,
				dataList: []
			};
		}

		if (Component) Customerservice.__proto__ = Component;
		Customerservice.prototype = Object.create(Component && Component.prototype);
		Customerservice.prototype.constructor = Customerservice;
		Customerservice.prototype.apiready = function() {
			var msgList = [
				{
					type: "self",
					icon: "../../image/user.png",
					text: "收到货后，发现产品存在问题如何处理？"
				},
				{
					type: "user",
					icon: "../../image/missfresh.png",
					text:
						"亲，收到快递时请当面验收，如产品存在品质问题请尽快联系在线客服（收货24小时内），并拍照上传，我们会竭尽全力为您解决问题。"
				},
				{
					type: "self",
					icon: "../../image/user.png",
					text: "请问我选的这款产品有货吗？"
				},
				{
					type: "user",
					icon: "../../image/missfresh.png",
					text: "您好，店铺内所有在架商品都是现货，欢迎您选购！"
				},
				{
					type: "self",
					icon: "../../image/user.png",
					text: "没有时间收货，能修改地址或改天再送吗？"
				},
				{
					type: "user",
					icon: "../../image/missfresh.png",
					text:
						"您好，由于本店所售产品为生鲜类商品，一旦发出，不接受更改地址或改天送货的，请侊见谅与理解。"
				},
				{
					type: "self",
					icon: "../../image/user.png",
					text: "现在我不在收货地址，不能签收快件，我不想要了可以退款吗？"
				},
				{
					type: "user",
					icon: "../../image/missfresh.png",
					text:
						"您好，根据国家相关法律，本店所售产品为生鲜类商品，不支持7天无理由退换货。请您尊重我们的劳动成果，如国顾客本人不在收货地址，不方便签收，不想要了，家中无人等收件人个人原因造成的退换货均不予退换，谢谢您的配合。"
				},
				{
					type: "self",
					icon: "../../image/user.png",
					text: "美食送物流超区，但之前我所在地区是可以收到快递的。"
				},
				{
					type: "user",
					icon: "../../image/missfresh.png",
					text:
						"您好，您所在的地区美食送物流是系统自动导航地址，没有人工确认操作。可能会定位出错导致超出快递的派送范围。请您联系在线客服给您整单退款。优惠卷可以第一时间返还给您。请您重新下单后第一时间联系在线客服改为京东快递配送，给您带来的不便还望见谅。"
				},
				{
					type: "self",
					icon: "../../image/user.png",
					text: "团购返现没有及时到帐是什么原因？"
				},
				{
					type: "user",
					icon: "../../image/missfresh.png",
					text:
						"您好，团购返现是系统自动返现的，如果您没有收到返现通知，请联系在线客服帮您查询。如果没有返现记录我们会帮您手动返现，退款返现是原路返回到您的支付账户中的，到帐时间为7个工作日内，请您注意查收。"
				},
				{
					type: "self",
					icon: "../../image/user.png",
					text:
						"谁都允在参加团购时，我作为团长想要和朋友一起团，但总是有人挤进来。于是朋友就无法加入我的团购。"
				},
				{
					type: "user",
					icon: "../../image/missfresh.png",
					text:
						"您好，您发起的团购在附近的团购中是可以被他人看到并参与的，付款成功后库房会按照订单顺序照常发货，满团后系统会自动返现的。"
				},
				{
					type: "self",
					icon: "../../image/user.png",
					text: "订单错发如何解决？"
				},
				{
					type: "user",
					icon: "../../image/missfresh.png",
					text:
						"您好，订单错发可拍照截图并上传给在线客服，在线客服会立即为您处理并进行退款。"
				},
				{
					type: "self",
					icon: "../../image/user.png",
					text: "为什么系统无法支付？"
				},
				{
					type: "user",
					icon: "../../image/missfresh.png",
					text:
						"您好，您可以先截图提示无法支付的页面给在线客服，以便我们确定具体原因，并第一时间给您处理。"
				}
			];

			this.data.dataList = msgList;
			this.scrollToBottom(false);

			var that = this;
			api.addEventListener(
				{
					name: "keyboardshow"
				},
				function(ret) {
					that.data.marginBottom = ret.h;
				}
			);
			api.addEventListener(
				{
					name: "keyboardhide"
				},
				function(ret) {
					that.data.marginBottom = 0;
				}
			);
		};
		Customerservice.prototype.sendMsg = function() {
			var input = document.getElementById("input");
			var text = input.value;
			if (text && text.length > 0) {
				var listView = document.getElementById("listView");
				var data = {
					type: "self",
					icon: "../../image/user.png",
					text: text
				};

				this.data.dataList = this.data.dataList.concat(data);
				this.scrollToBottom(true);
				input.value = "";
			}
		};
		Customerservice.prototype.onfocus = function(e) {
			this.scrollToBottom(true);
		};
		Customerservice.prototype.scrollToBottom = function(animated) {
			setTimeout(function() {
				var listView = document.getElementById("listView");
				listView.scrollTo({
					position: "lower",
					animated: animated
				});
			}, 30);
		};
		Customerservice.prototype.render = function() {
			var this$1 = this;
			return apivm.h(
				"view",
				{class: "main", style: "margin-bottom:" + this.data.marginBottom + "px;"},
				apivm.h("navigationBar", {title: "客服"}),
				apivm.h(
					"view",
					{class: "container"},
					apivm.h(
						"scroll-view",
						{class: "listView", id: "listView", "scroll-y": "true"},
						Object.entries(this.data.dataList).map(function(ref) {
							var index$1 = ref[0];
							var item$1 = ref[1];
							return apivm.h(
								"view",
								{class: item$1.type == "self" ? "cellSelf" : "cellUser"},
								apivm.h("image", {class: "icon", src: item$1.icon}),
								apivm.h("view", {
									class: item$1.type == "self" ? "rightArrow" : "leftArrow"
								}),
								apivm.h(
									"view",
									{class: item$1.type == "self" ? "contentBgSelf" : "contentBgUser"},
									apivm.h("text", {class: "text"}, item$1.text)
								)
							);
						})
					),
					apivm.h(
						"view",
						{class: "input-bar"},
						apivm.h("textarea", {
							id: "input",
							class: "input",
							"auto-height": true,
							"show-confirm-bar": false,
							onfocus: this.onfocus,
							onconfirm: this.sendMsg
						}),
						apivm.h(
							"text",
							{
								class: "sendBtn",
								onclick: function(event) {
									if (this$1.sendMsg) {
										this$1.sendMsg();
									} else {
										sendMsg();
									}
								}
							},
							"发送"
						)
					),
					apivm.h("safe-area", null)
				)
			);
		};

		return Customerservice;
	})(Component);
	apivm.define("customerservice", Customerservice);
	apivm.render(apivm.h("customerservice", null), "body");
})();

	window['createApp'] = function() {
		apivm.$_start();
	}
	return avm;
}